let config;
let noteConfig;
const md = window.markdownit();
axios.get('../static/data/noteConfig.json') //在config文件加载完后再回调运行vue
    .then(function (response) {
        noteConfig = response.data;
        axios.get('../static/data/commonConfig.json') //在config文件加载完后再回调运行vue
            .then(function (response) {
                commonConfig = response.data;
                runVue();
            })
            .catch(function (error) {
                console.log(error);
            })
    })
    .catch(function (error) {
        console.log(error);
    })
// VUE脚本
const runVue = () => {
    const {ref, computed, reactive} = Vue;
    const App = {
        setup() {
            const topBars = commonConfig['topBars'];
            const isLogin = ref(false);
            const userButtonText = commonConfig['userButtonText'];
            const goTo = (link) => {
                window.location.href = link;
            }
            const text = ref(md.render("# Hello World\n" +
                "```java\n" +
                "public class Main{\n" +
                "\tpublic static void main(String[] args){\n" +
                "\t\tSystem.out.println(\"Hello World!\");\t\t\n" +
                "\t}\n" +
                "}\n" +
                "```\n" +
                "> HHHH\n" +
                "* asdad\n" +
                "* asdasd\n" +
                "\t* asdasd\n" +
                "\t* cjjxczxc\n" +
                "\n" +
                "    \n" +
                "asdad `asdasd`"));
            return {
                goTo,
                topBars,
                isLogin,
                userButtonText,
                text
            }
        },
    };
    const app = Vue.createApp(App);
    app.mount("#app");
}